﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IdentityModel.Selectors;
using System.Security.Cryptography.X509Certificates;
using System.IdentityModel.Tokens;

namespace Cesave.DistributedServices.PermisosModule
{
    public class PermisosModuleX509CertificateValidator
        : X509CertificateValidator
    {

        #region X509CertificateValidator overrides

        public override void Validate(X509Certificate2 certificate)
        {
            if (certificate == null)
                throw new ArgumentNullException("certificate");

			if (certificate.SubjectName.Name != "CN=CesaveServer")
                throw new SecurityTokenValidationException("Certificate was not issued by trusted issuer");
        }

        #endregion

    }
}
